#include		"BoostRotatingBuffer.h"

BoostRotatingBuffer::BoostRotatingBuffer() : _buffer(4096)
{

}

BoostRotatingBuffer::~BoostRotatingBuffer()
{

}

void			BoostRotatingBuffer::init()
{
	_buffer.clear();
}

byte			BoostRotatingBuffer::read()
{
	byte		data = 0;

	if (!empty())
	{
		data = *_buffer.begin();
		_buffer.pop_front();
	}
	return data;
}

void			BoostRotatingBuffer::write(byte data)
{
	_buffer.push_back(data);
}

bool			BoostRotatingBuffer::empty()
{
	return _buffer.empty();
}

int				BoostRotatingBuffer::size()
{
	return _buffer.size();
}

int				BoostRotatingBuffer::capacity()
{
	return _buffer.capacity();
}

byte			BoostRotatingBuffer::operator[](size_t value)
{
	return _buffer[value];
}